package com.example.thymelplay.controller;


import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @GetMapping("test")
    public Authentication test(){
        SecurityContext context = SecurityContextHolder.getContext();
        Authentication authentication = context.getAuthentication();
        return authentication;
    }

    @GetMapping("delete")
    public String delete(){
        return "用户删除操作";
    }

    @GetMapping("insert")
    public String insert(){
        return "用户注册操作";
    }

    @GetMapping("query")
    public String select(){
        return "查询用户操作";
    }

    @PostMapping("success")
    public String succes(){
        return "恭喜您登录成功";
    }
}
